# class Tools(object):
#     count = 0
#     '''类属性'''
#     def __init__(self,name):
#         self.name = name
#         # 每一个工具的名字,是实例的属性
#         Tools.count += 1
#         '''调用类属性  类名.类属性'''
#     @classmethod
#         # 装饰器
#     def show_tool_count(cls):
#         # 创建类方法
#         print(cls.count)
#     def __str__(self):
#         return f'{self.name}'
# n1 = Tools('扳手')
# n2 = Tools('钳子')
# # 调用类方法
# Tools.show_tool_count()
# print(n1)

class Student(object):
    num = 0
    def __init__(self,name,score):
        self.name = name
        self.score = score
        Student.num += 1
        # 调用类属性 类名.属性
    @classmethod
    def show_num(cls):
        print(f'班级总人数为{cls.num}')
    def __str__(self):
        return (f"学生姓名{self.name},考试分数{self.score}")
Student.show_num()
n1 = Student('mike',59)
n2 = Student('yoyo',88)
print(n1)
print(n2)
Student.show_num()
